x = 0
y = 0
z = 1
k = [
    [0,0,0],
    [0,0,0],
    [0,0,0],
]
w = 3
h = 3
while z<9:
    while x+1<3 and k[x+1][y]==0:
        k[x][y] = z
        x += 1
        z += 1
    while y+1<3 and k[x][y+1]==0:
        k[x][y] = z
        y += 1
        z += 1
    while x-1>=0 and k[x-1][y]==0:
        k[x][y] = z
        x -= 1
        z += 1
    while y-1>=0 and k[x][y-1]==0:
        k[x][y] = z
        y += 1
        z += 1

print(k)